﻿<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<!DOCTYPE html>
<head>
<title>问卜后台管理系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="nofollow"/>
<link href="style/adminStyle.css" rel="stylesheet" type="text/css" />

<style>
body{
width:100%;
height:100%;
overflow:hidden;
background:url(images/pc_loginBg.jpg) no-repeat;
background-size:cover;
position:absolute;}
#bt-login:hover{

color: #000000;

}



</style>
<script src="js/jquery.js"></script>
<script src="js/Particleground.js"></script>

<script>
function benttion(){
   
	

	  if($("#uname").val()==""||$("#uname").val()==null){
		  alert("账号不能为空");
		  return false;
	  }

	    if($("#upwd").val()==""||$("#upwd").val()==null){
	    	 alert("密码不能为空");
	    	 return false;
	 
		}
    //异步提交请求，进行验证
   $.ajax({
	   "url":"${pageContext.request.contextPath}/Administrators/index.do",
	   "data":"rname="+$("#uname").val()+"&rpassword="+$("#upwd").val(),
	   "type":"POST",
	   "dataType":"json",
	   "success":function(obj){
		   if(obj.state==1){
			   location.href="${pageContext.request.contextPath}/Administrators/login.do";
		   }else if(obj.state==400){
			   alert("账号不存在");
		   }else{
			   alert("密码错误");
		   }
		   
	   }
   });
}

</script>
<script type="text/javascript">
//实现回车登陆
	document.onkeydown = function(event){
	  var e = event || window.event; //兼容ie
	  switch(e.keyCode) {
	    case 13: // enter 键
	      if (!window.buttonIsFocused) benttion(); // benttion()是封装登录的方法
	      break;
	  }
	};


</script>
</head>
<body >
  <section class="loginform">
   <h1>问卜后台管理系统</h1>
   <ul>
    <li>
     <label>账号：</label>
     <input type="text"   name="uname" id="uname" class="textBox" placeholder="管理员账号" value="${admin.rname}" />
    </li>
    <li>
     <label>密码：</label>
     <input type="password" class="textBox" name="upwd" id="upwd"  placeholder="登陆密码"  value="${admin.rpassword}"/>
    </li>
    <!-- <li> 
     <input type="checkbox" name="isUseCookies" checked="checked"/>十天内记住我的登陆状态
    </li> -->
    <li>
     <input type="button" id="bt-login" value="立即登陆" onclick="benttion()" onfocus="window.buttonIsFocused=true;" onblur="window.buttonIsFocused=false;"/>
    </li>
   </ul>
  </section>
  <!--错误提示-->
<div id="showResult"></div>
</body>
</html>